__author__ = 'Administrator'
from django.http import HttpResponse

text = '''<form method="post" action="add">
    <input type="text" name="a" value="%d"></input> + <input type="text" name="b" value="%d"></input>
    <input type="submit" value="="></input> <input type="text" name="c" value="%d"></input>
</form>'''

def index(request):
    if request.POST.has_key('a'):
        a = int(request.POST['a'])
        b = int(request.POST['b'])
    else:
        a = 0
        b = 0
    return HttpResponse(text %(a,b,a+b))